package com.yinNuo.collectWool.utils;


import cn.hutool.json.JSONUtil;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
* create by: yinNuo
* create at: 2021/12/18 下午4:41
* description: 渲染工具类
*/
public class RenderUtil {

	/**
	 * 渲染json对象
	 */
	public static void renderJson(HttpServletResponse response, Object jsonObject) {
		try {
			response.setContentType("application/json");
			response.setCharacterEncoding("UTF-8");
			PrintWriter writer = response.getWriter();
			writer.write(JSONUtil.toJsonStr(jsonObject));
		} catch (IOException e) {
			e.getMessage();
		}
	}
}
